#include "blood.h"

// Make person object
Blood::Blood(QWidget * _parent, int x, int y)
{
    this->setParent(_parent); // set the parent

    // Initialize this label
    this->setGeometry(x - 38, y - 64, 100, 100); // minus on this line to make it touch bottom of window evenly

    // Set up movie
    animMovie = new QMovie();
    animMovie->setParent(this);

    // Set up Object ID
    int tempID;
    tempID = ((HelicopterForm*)(this->parent()))->GetFreeBloodID();
    this->setObjectName(QString::number(tempID) + "b");

    // Add the movie
    SetBloodMovie("images/blood.mng");

    // Create the timer eventually destroy the image
    BloodTimer *timer = new BloodTimer(((HelicopterForm*)(this->parent())), tempID);
    timer->object = this;
}

// Sets up the blood movie
void Blood::SetBloodMovie(QString link)
{
    // Add the movie
    animMovie->stop();
    animMovie->setFileName(link);
    this->setMovie(animMovie);

    animMovie->setSpeed(500);
    animMovie->start();
}
